<?php
$model = $data;
$quantity = $model->quantity == 0 ? '- Sold -' : $model->quantity;
$name = is_numeric($quantity) ? $model->name : "$model->name (Sold)";
?>
<li class="shop-item">
	<h2><?php echo CHtml::link($name, array('item/view', 'id' => $model->id)) ?></h2>
	<?php echo CHtml::link(CHtml::image(Yii::app()->baseUrl . "/uploads/thumbnails/$model->id.jpg"), array('item/view', 'id' => $model->id)) ?>
	<div class="info">
		<p><?php echo isset($model->description[0]) ? CHtml::encode($model->description) : '<em>no description</em>'; ?></p>
		<b><?php echo CHtml::encode($model->getAttributeLabel('quantity')); ?>:</b>
		<?php echo CHtml::encode($quantity); ?>,
		<b><?php echo CHtml::encode($model->getAttributeLabel('price')); ?>:</b>
		$<?php echo CHtml::encode($model->price); ?>
		<br />
		<span><?php echo CHtml::link("View Shop", array('user/view', 'id' => $model->user_id)) ?></span>
	</div>
</li>